#全局当前路径的文件
path =os.path.abspath(os.path.dirname(__file__))

def create_file(path,name ='lcmtest',timestamp=True):
    if timestamp:#TRUE
        time_stamp =time.strftime("%Y-%m-%d-%H-%M-%S",time.gmtime())
    #拼接路径格式
    full_path =os.path.join(path+'/log',name)
    if not os.path.exists(full_path):
        f=open(full_path,'w')
        f.close()
    #下面使用
    return full_path

#删除包名
def remove(driver,uiapp="包名"):
    a =driver.is_app_installed(uiapp)
    if a:
        driver.remove_app(uiapp)
        driver.implicitlyWait(5)
    else:
        print "没有这个包"

#设置网络类型
from appium.webdriver.connectiontype import ConnectionType
'''
NO_CONNECTION = 0
AIRPLANE_MODE = 1
WIFI_ONLY = 2
DATA_ONLY = 4
ALL_NETWORK_ON = 6
'''
def network(driver,Contype=ConnectionType.WIFI_ONLY):
    return driver.set_network_connection(Contype)